package com.example.stusystem.service.Impl;

import com.example.stusystem.Dao.StudentMapper;
import com.example.stusystem.pojo.Manager;
import com.example.stusystem.pojo.Student;
import com.example.stusystem.service.ServiceLogic;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ServiceLogicImpl implements ServiceLogic {
    @Autowired
    StudentMapper studentMapper;

    @Override
    public List<Student> selectAllService() {
        List<Student> students = studentMapper.selectAllDao();
        return students;
    }

    @Override
    public void addOneService(Student student) {
        studentMapper.addOneDao(student);
    }

    @Override
    public void deleteDataService(Integer id) {
        studentMapper.deleteDataDao(id);
    }

    @Override
    public Student selectOneService(Integer id) {
        Student student = studentMapper.selectOneDao(id);
        return student;
    }

    @Override
    public void updateService(Student student) {
        studentMapper.updateDao(student);
    }

    @Override
    public Manager isAdminService(Manager manager) {
        Manager adminDao = studentMapper.isAdminDao(manager);
        return adminDao;
    }
}
